Change Text Color body { font-family: Arial, sans-serif; background: #f0f0f0; text-align: center; margin-top: 100px; } p { font-size: 24px; color: black; transition: color 0.4s ease; } button { padding: 10px 20px; font-size: 18px; background-color: #007bff; color: white; border: none; border-radius: 8px; cursor: pointer; transition: 0.3s; } button:hover { background-color: #0056b3; } This text will change its color when you click the button!Change Color function changeColor() { const colors = ["red", "blue", "green"]; const randomColor = colors[Math.floor(Math.random() * colors.length)]; document.getElementById("text").style.color = randomColor; }